﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using fileDeom.Models;
using System.IO;

namespace fileDeom.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            string dirPath = "C:/文稿/";
            if (Directory.Exists(dirPath))
            {
                //获得目录信息
                DirectoryInfo dir = new DirectoryInfo(dirPath);
                //获得目录文件列表
                FileInfo[] files = dir.GetFiles("*.*");
                string[] fileNames = new string[files.Length];

                //临时数据表
                List<string> dt = new List<string>();
                dt.Add("FileName");
            }
                return View();
        }
        public IActionResult test()
        {
            string dirPath = "C:/文稿/";
            if (Directory.Exists(dirPath))
            {
                //获得目录信息
                DirectoryInfo dir = new DirectoryInfo(dirPath);
                //获得目录文件列表
                FileInfo[] files = dir.GetFiles("*.*");
                string[] fileNames = new string[files.Length];

                //临时数据表
                List<string> dt = new List<string>();
                dt.Add("FileName");

                //foreach (FileInfo fileInfo in files)
                //{
                //    DataRow dr = dt.NewRow();
                //    dr["FileName"] = fileInfo.Name;
                //    dt.Rows.Add(dr);

                //}
                //Repeater1.DataSource = dt;
                //Repeater1.DataBind();
            }
            return View();
        }

        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}
